package com.owc.domain.dto.admin;

import com.owc.common.converter.OutputConverter;
import com.owc.common.enums.StatusEnum;
import com.owc.domain.entity.RechargeFlow;
import com.owc.domain.entity.User;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;

/**
 * @Author Jackies
 * @Date 2019/12/16 21:34
 * @Description TODO://
 **/
@NoArgsConstructor
@Data
public class RechargeListDTO implements OutputConverter<RechargeListDTO, RechargeFlow> {

    private Long id;
    private String rechargeId;
    private String tokenName;
    private String phone;
    private String commitTime;
    private BigDecimal rechargeAmount;
    private BigDecimal realAmount;
    private Integer status;

    @Override
    public void customConverter(RechargeListDTO rechargeListDTO, RechargeFlow rechargeFlow) {
        rechargeListDTO.setRechargeId(rechargeFlow.getTransferId());
        rechargeListDTO.setRechargeAmount(rechargeFlow.getRealAmount());
        if(StatusEnum.SUCCESS.getType().equals(rechargeFlow.getStatus())){
            rechargeListDTO.setRealAmount(rechargeFlow.getRealAmount());
        }
        rechargeListDTO.setCommitTime(rechargeFlow.getRechargeTime());
    }
}
